// Addon by RabidToaster... New achievements by Dark Shadow [DK]

local total = achievements.GetValue( "Naughty", "total", 0 )

local oldRate
local function Update()
	local ply = LocalPlayer()
	if ( !ValidEntity( ply ) ) then return end
	if ( total == 10 ) then return end	
	
	local badboy = ply:GetNWInt( "Rating.bad" )
	if ( badboy > ( oldRate or badboy ) ) then
		if ( oldRate != 0 || badboy == 1 ) then
			total = math.Clamp( total + ( badboy - oldRate ), 0, 10 )
			achievements.Update( "Naughty", total / 10, total .. "/10" )
			achievements.SetValue( "Naughty", "total", total )
		end
	end
	oldRate = badboy
end
timer.Create( "Achievements.Naughty", 1, 0, Update )

achievements.Register( "Naughty", "Get rated 'naughty' 10 times.", "achievements/naughty", total / 10, total .. "/10" )